<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header('npc')"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content">
	<div class="col-sm-12">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>基本信息</h5>
						<div class="ibox-tools">
							<a class="collapse-link">
								<i class="fa fa-chevron-up"></i>
							</a>
						</div>
					</div>
					<div class="ibox-content">
						<div class="row">
							<div class="col-sm-12">
								<table class="table table-hover margin bottom">
									<tbody>
									<tr>
										<td>地名</td>
										<td th:text="${fantasyCitymap.placename}">RuoYi</td>
									</tr>
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>

		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>NPC</h5>
						<a class="btn btn-success btn-xs" th:onclick="addNpc([[${fantasyCitymap.id}]])">
							<i class="fa fa-plus"></i> 添加
						</a>
						<div class="ibox-tools">
							<a class="collapse-link">
								<i class="fa fa-chevron-up"></i>
							</a>
						</div>
					</div>
					<div class="ibox-content">
						<div class="row">
							<div class="col-sm-12">
								<table class="table table-hover margin bottom">
									<tbody>
									<tr th:if="${#lists.isEmpty(fantasyNpcPositionList) != true}" th:each="fantasyNpcPosition : ${fantasyNpcPositionList}">
										<td>名称</td>
										<td th:text="*{fantasyNpcPosition.npcName}">RuoYi</td>
									</tr>
									<tr th:if="${#lists.isEmpty(fantasyNpcPositionList)}">
										<td>当前地点暂无NPC</td>
									</tr>
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "fantasy/fantasyCitymap";

        //新增npc
        function addNpc(id) {
            console.log(id);
		    var addNpcUrl = prefix + "/addNpc/{id}";
            console.log(addNpcUrl)
            var url = addNpcUrl.replace("{id}", id);
            console.log(url)
            $.modal.open("新增npc", url);
        };


        $(".modal").appendTo("body"), $("[data-toggle=popover]").popover(), $(".collapse-link").click(function() {
            var div_ibox = $(this).closest("div.ibox"),
                e = $(this).find("i"),
                i = div_ibox.find("div.ibox-content");
            i.slideToggle(200),
                e.toggleClass("fa-chevron-up").toggleClass("fa-chevron-down"),
                div_ibox.toggleClass("").toggleClass("border-bottom"),
                setTimeout(function() {
                    div_ibox.resize();
                }, 50);
        }), $(".close-link").click(function () {
            var div_ibox = $(this).closest("div.ibox");
            div_ibox.remove()
        });
	</script>
</body>
</html>
